windows forms iterate through all controls

95

windows forms iterate through all controls -

private void LoopThroughControls(Control parent)
{
    foreach (Control c in parent.Controls)
    {
        if (c.GetType() == typeof(YourType)) {
            //Do stuff
        } else {
            LoopThroughControls(c);
        }
    }
}

Comments

Submit
0 Comments